package com.lechuang.web.config;

import com.lechuang.web.interceptor.WebInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * <p>
 *  拦截器
 * </p>
 *
 * @author liaoningbo
 * @since 2023-12-18
 */
@Configuration
public class WebConfiguration implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //添加自定义拦截器
        registry.addInterceptor(new WebInterceptor())
                // 拦截的请求
                .addPathPatterns("/**")
                // 不用拦截的请求
                .excludePathPatterns("/login")
        ;
    }
}
